home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
util1
/
snap_v20.lha
/
Snap
/
Patch.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-04
|
724b
|
41 lines
#ifdef LATTICE
typedef ULONG(*FPTR) ();
#endif
#ifdef AZTEC_C
typedef VOID(*FPTR) ();
#endif
IMPORT struct IntuitionBase *IntuitionBase;
#define LVOActivateWindow -0x01c2L
VOID __stdargs __saveds myActivateWindow( void);
LONG oldActivateWindow;
STATIC WORD patched = 0;
VOID SafePatch( void)
{
if (!patched)
{
Forbid(); /* I don't expect interrupts to do much intuition */
oldActivateWindow = (LONG) SetFunction((struct Library *)IntuitionBase, LVOActivateWindow, (FPTR) myActivateWindow);
Permit();
patched = 1;
}
}
VOID SafeRestore( void)
{
if (patched)
{
Forbid();
(VOID) SetFunction((struct Library *)IntuitionBase, LVOActivateWindow, (FPTR) oldActivateWindow);
Permit();
patched = 0;
}
}